answer "Install into Home stack?" with "Cancel" or "No" or "Yes"
if it = "Cancel" then
answer "Installation Cancelled" with "OK"
exit mouseUp
else if it = "Yes" then
put true into HomePath
put word 2 of the long name of stack "Home" into tmp
delete char 1 of tmp
delete last char of tmp
put tmp into DestPath
else
put false into HomePath
put StandardFile("get", "STAK") into DestPath
if DestPath = "" then
answer "Installation Cancelled" with "OK"
exit mouseUp
end if
end if
put word 2 of the long name of this stack into tmp
delete char 1 of tmp
delete last char of tmp
put tmp into MyPath
DoCopy MyPath,DestPath,"XPRC","Globals"
DoCopy MyPath,DestPath,"XPRC","PGlobals"
DoCopy MyPath,DestPath,"XCMD","ZapGlobals"
if HomePath then
answer "Edit script of Home stack to 'ZapGlobals'?" with "No" or "Yes"
if it = "No" then
hide msg
exit mouseUp
end if
EditScript DestPath
end if
hide msg
end mouseUp
-- part 8 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=368 top=22 right=97 bottom=509
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part 9 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=2 top=22 right=46 bottom=320
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 18
-- style flags: 768
-- line height: 24
-- part name:
-- part 10 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=2 top=52 right=72 bottom=320
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 14
-- style flags: 768
-- line height: 18
-- part name:
-- part 12 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=2 top=79 right=97 bottom=320
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 13 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=129 top=318 right=340 bottom=229
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Sample╔
----- HyperTalk script -----
on mouseUp
go card "Sample"
end mouseUp
-- part 14 (button)
-- low flags: 00
-- high flags: 0001
-- rect: left=0 top=19 right=49 bottom=38
-- title width / last selected line: 0
-- icon id / first selected line: 28023 / 28023
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Home Base
----- HyperTalk script -----
on mouseUp
visual effect barn door close
go stack "Home Base"
end mouseUp
-- part contents for card part 4
----- text -----
Preserving the values of global variables between separate calls of XCMDs or XFCNs is not easy - where do you store the values? This stack provides a solution…
ΓÇó an XCMD "ZapGlobals" - see ZapGlobals below.
• two code resources (type XPRC), “Globals” for C and “PGlobals” for    Pascal, which provide a globals storage service. These are both code    resources with an entry point at their start and are of type:
      Handle Globals(int selector, long id, long size);
   ° GetGlobals: selector = 1. 'id' should be a unique identifier for       your global storage, 'size' is the number of bytes to allocate if       the globals don't already exist - if zero nothing will be allocated.       The result is a handle (unlocked) to your global storage, or NIL if       there was an error or the globals don't exist and 'size' was zero.       For example:
       h = (**procHandle)(1, 'talk', sizeof struct talkdata);
   ° FreeGlobals: selector = 2. 'id' as above, 'size' unused (may be       omitted in C but NOT in Pascal!). Removes the globals and       deallocates their memory. Returns NIL. For example:
       (**procHandle)(2, 'talk');
   ° ZapGlobals: selector = 3, 'id' and 'size' unused. Removes all       globals but DOES NOT deallocate their memory. This is called (via       the 'ZapGlobals' XCMD) on HyperCard shutdown and suspension -       messages 'quit' and 'suspend'. You shouldn't need to call this
  yourself.
These two XPRCs and the XCMD may be installed in your Home stack, so all XCMDs and XFCNs can use them, by pressing the "Install…" button. A sample C interface to these routines may be seen by pressing "Sample…"